Distinguishing Graph Structures
A graph is defined by a set of vertices and a set of edges . Understanding whether edges impose directionality is foundational for pathfinding algorithms (e.g., BFS, DFS) and modeling dependencies.
| Feature | Undirected Graph | Directed Graph (Digraph) |
|---|---|---|
| Edge Representation | (A set, symmetric) | (An ordered pair, asymmetric) |
| Meaning | Simple connectivity | Flow, Dependency, Hierarchy |
| Traversal | If exists, must also exist implicitly. | does not imply . |
Degree and The Handshaking Lemma
The degree of a vertex () is the count of edges incident to it. In directed graphs, we track in-degree () and out-degree ().
The Handshaking Lemma (Fundamental Theorem)
For any undirected graph , the sum of the degrees of all vertices is exactly twice the number of edges:
Justification: Every edge is counted exactly once at each of its two endpoints.
1. A small undirected graph has 6 vertices. The degrees of 5 vertices are . What is the degree of the 6th vertex, and how many edges does have?
Hint: The total degree sum must be an even number.
2. An edge in a graph is represented as an ordered pair . What does this imply?
3. In a directed graph with 10 edges, what is the sum of the in-degrees of all its vertices?
4. Which of the following degree sequences is IMPOSSIBLE for a simple undirected graph with 5 vertices?
Hint: Consider the number of vertices with odd degrees.